<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('新增仓库信息')" />
    <script type="text/javascript" src="../../../js/jquery.min.js"></script>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-space-add">
            <div class="form-group">    
                <label class="col-sm-3 control-label">商品名称：</label>
                <div class="col-sm-8">
                    <select class="form-control" id="spmc" name="pId">
                        <option>----请选择---</option>
                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">所在仓库：</label>
                <div class="col-sm-8">
                    <select class="form-control" id="ck" name="stroeId">

                    </select>
                </div>
            </div>
            <div class="form-group">    
                <label class="col-sm-3 control-label">入库数量：</label>
                <div class="col-sm-8">
                    <input name="stroeSpaceNum" class="form-control" type="text" required>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script type="text/javascript">
        var prefix = ctx + "wms/space"
        $("#form-space-add").validate({
            focusCleanup: true
        });

        $(function () {
            $.post("/wms/product/list",function (result) {
                for (var i in result.rows){
                    $("#spmc").append("<option value='"+result.rows[i].pId+"'>"+result.rows[i].pName+"</option>")
                }
            })
        })
       $(function () {
            $.post("/wms/stroe/list",function (result) {
                for (var i in result.rows) {
                    $("#ck").append("<option value='"+result.rows[i].stroeId+"'>"+result.rows[i].stroeName+"</option>")
                }
            })
        })

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/add", $('#form-space-add').serialize());
            }
        }
    </script>
</body>
</html>